<template>
  <div>
    <!--    面包屑导航  -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>商品管理</el-breadcrumb-item>
      <el-breadcrumb-item>商品列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <!--  表格展示商品列表  -->
      <el-table :data="goodsList" border style="width: 50%">
        <el-table-column type="index" width="100" align="center">
        </el-table-column>
        <el-table-column prop="goods_name" label="商品名称" align="center">
        </el-table-column>
        <el-table-column prop="goods_price" label="商品价格" align="center">
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        queryInfo:{
          query:'',
          pagenum:1,
          pagesize:3
        },
        goodsList:[],
      }
    },
    created () {
      this.getGoodsList()
    },
    methods: {
      async getGoodsList () {
        const { data : res } = await this.$http.get('goods',{ params : this.queryInfo})
        console.log(res)
        if(res.meta.status !== 200) return this.$message.error('获取商品列表失败')
        this.goodsList = res.data.goods
        console.log(this.goodsList)
      },
    }
  }
</script>
<style></style>
